package part_1;

/*
   Purpose:
     This class tests the Date class.

   Record of revisions:
       Date       Programmer          Description of change
       ====       ==========          =====================
       05/01/2002 S. J. Chapman       Original code
       15/05/2008 S Billemont		  Added an other date and the reduced date meth is called
*/
public class TestDate {

   // Define the main method to test class Date
   public static void main(String[] args) {

      // Declare variables, and define each variable
      Date d1 = new Date(4,1,1996);   // Date1	  
      Date d2 = new Date(1,3,1998);   // Date 2
      Date d3 = new Date();           // Date 3
      Date d4 = new Date();           // Date 4
      
      Date d5 = new Date(3,3,1995);
      d5.priorDay();
      System.out.println("D5: " + d5);
      
      // Set d3
      d3.setDate(3,1,1996);

      // Print out dates
      System.out.println ("Date 1 = " + d1);
      System.out.println ("Date 2 = " + d2);
      System.out.println ("Date 3 = " + d3);
      System.out.println ("Date 4 = " + d4);
      
      // Check isLeapYear
      if ( d1.isLeapYear() )
         System.out.println (d1.getYear() + " is a leap year.");
      else
         System.out.println (d1.getYear() + " is not a leap year.");

      if ( d2.isLeapYear() )
         System.out.println (d2.getYear() + " is a leap year.");
      else
         System.out.println (d2.getYear() + " is not a leap year.");

      // Check isEqual
      if ( d1.isEqual(d3) )
         System.out.println (d3 + " is equal to " + d1);
      else
         System.out.println (d3 + " is not equal to " + d1);

      // Check isEarlier
      if ( d1.isEarlier(d3) )
         System.out.println (d1 + " is earlier than " + d3);
      else
         System.out.println (d1 + " is not earlier than " + d3);

      // Check isLater
      if ( d1.isLater(d3) )
         System.out.println (d1 + " is later than " + d3);
      else
         System.out.println (d1 + " is not later than " + d3);
      
      // Decrease the date
      
      //TODO: Extensive testing of the correct decreasing of the date ...
      
      System.out.println();
      System.out.println ("Decreasing dates ...");
      d1.priorDay();
      d2.priorDay();
      d3.priorDay();
      d4.priorDay();
      System.out.println ("Date 1 = " + d1);
      System.out.println ("Date 2 = " + d2);
      System.out.println ("Date 3 = " + d3);
      System.out.println ("Date 4 = " + d4);
   }
}
